﻿/// Write a program that reads two numbers N and K and generates all the variations of K elements from the set [1..N]. 
/// Example:	N = 3, K = 2  {1, 1}, {1, 2}, {1, 3}, {2, 1}, {2, 2}, {2, 3}, {3, 1}, {3, 2}, {3, 3}


using System;

class zad120
{
    static void Main()
    {
        int n = 3;
        int k = 2;
        int[] arr = new int[k];

        Variations(arr, 0, n);
    }

    static void Variations(int[] array, int current, int length)
    {
        if (current == array.Length)
        {
            for (int i = 0; i < array.Length; i++)
            {
                Console.Write(array[i] + " ");
            }
            Console.WriteLine();
        }
        else
        {
            for (int i = 1; i <= length; i++)
            {
                array[current] = i;
                Variations(array, current + 1, length);
            }
        }
    }
}

